package com.axun.ckz.mysocketdemo.base

import android.content.Context


/**
 * Created by ckz on 2018/4/23.
 */

class IBasePresenter(internal var context: Context, internal var mView: IBaseView?) {
    internal var module: IBaseModule

    init {
        module = IBaseXm(context)
    }

    protected fun saveUser(userId: String) {
        module.saveUser(userId)
    }

    protected fun showProgress(progress: String) {
        if (mView != null) {
            mView!!.showProgress(progress)
        }
    }

    protected fun hideDialog() {
        if (mView != null) {
            mView!!.hideProgress()
        }
    }

    protected fun showUI(json: String) {
        if (mView != null) {
            mView!!.showUI(json)
        }
    }

    protected fun showError(error: String) {
        if (mView != null) {
            mView!!.showError(error)
        }
    }

    protected fun showFaild(msg: String) {
        if (mView != null) {
            mView!!.showFailed(msg)
        }
    }
}
